# -*- coding:utf-8 -*-
from datetime import datetime
from email.policy import default

from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union

from config.model_base import BaseMinXinModel
from module_admin.annotation.pydantic_annotation import as_query


class BgFileCategoryModel(BaseMinXinModel):
    """
    表对应pydantic模型
    """
    ancestors: Optional[str] =  Field(default=None, description='祖级列表')
    category_name: Optional[str] =  Field(default=None, description='分类名称')
    file_count: Optional[int] =  Field(default=None, description='文件数量')
    order_num: Optional[int] =  Field(default=None, description='显示顺序')
    parent_id: Optional[int] =  Field(default=None, description='父分类id')
    status: Optional[str] =  Field(default=None, description='分类状态')



@as_query
class BgFileCategoryPageModel(BgFileCategoryModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class BgFileCategoryAddModel(BaseMinXinModel):
    """
    添加模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    category_name: Optional[str] =  Field(default=None, description='分类名称')
    order_num: Optional[int] =  Field(default=None, description='显示顺序')
    parent_id: Optional[int] =  Field(default=None, description='父分类id')

    ancestors: Optional[str] = Field(default=None, description='祖籍分类逗号分隔')
